import http from "@/http/index.ts"
import {SysMenu} from "@/api/menu/type.ts";

// 获取上级菜单
export const getParentApi = () => {
    return http.get("/sysMenu/getParent")
}

// 新增菜单
export const addApi = (data: SysMenu) => {
    return http.post("/sysMenu/createMenu", data)
}

// 列表菜单
export const getListApi = ()=>{
    return http.get("/sysMenu/list")
}

// 修改菜单
export const editApi = (data: SysMenu) => {
    return http.put("/sysMenu/updateMenu", data)
}

// 删除菜单
export const deleteApi = (menuId: number) => {
    return http.delete(`/sysMenu/deleteMenu/${menuId}`)
}

// 查询菜单树
export const getAssignTreeApi = (roleId:number) => {
    return http.get("/sysMenu/getAssignTree",{roleId:roleId})
}

// 获取菜单路由数据
export const getRoutersApi = () => {
    return http.get("/sysMenu/getRouter")
}

